class Solution:
    def smallestNumber(self, n: int) -> int:
        binary = str(bin(n))[2:]
        # print(binary)
        n = len(binary)
        # print('n=',n)
        return int('1'*n,2)